<template>
  <div class="order-info-box">
    <div class="list-item flex ai-c" >
      <div class="flex-1 flex">
        <div class="list-img">
          <img :src="orderInfo.productPic|nopic" alt=""  />
        </div>
        <div class="flex-1">
          <p v-if="orderStatus=='0'">您提交了订单，等待付款</p>
          <span>意向金￥{{orderInfo.productPrice}}</span>
        </div>
      </div>
      <div class="order-btn">
        <!--<div class="list-btn active" v-if="orderStatus==0" @click="toPay(orderInfo,orderStatus,payType)">去支付</div>-->
        <!--<div class="list-btn active" v-if="orderStatus==1" @click="toOrder(orderInfo)">立即订购</div>-->
        <!--<div class="list-btn" @click="goRefund" v-if="orderStatus==4">申请退款</div>-->
        <div class="list-btn" @click="toDetail(orderInfo,orderStatus)">订单详情</div>
        <!-- <div class="list-btn">联系客服</div> -->
      </div>
    </div>
    <el-dialog title="申请退款" :visible.sync="dialogVisible" width="30%">
      <el-form ref="form" label-width="80px">
        <el-form-item label="退款原因:">
          <el-select v-model="reason" placeholder="请选择" class="width-100" >
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="退意向金:">
          <el-input v-model="input" placeholder="请输入内容"></el-input>
          <span class="maney-remarks">最多￥1000，含发货邮费￥0.00</span>
        </el-form-item>
        <el-form-item label="" class="sub-btn">
          <el-button type="warning" @click="dialogVisible = false">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import empty from "../utils/common";

export default {
  props: ['orderInfo','orderStatus','payType'],
  data() {
    return {
      order:this.orderInfo,
      dialogVisible: false,
      input: '',
      reason: '',
      status:this.orderStatus,
      options: [{
          value: '选项1',
          label: '黄金糕'
        }, {
          value: '选项2',
          label: '双皮奶'
        }, {
          value: '选项3',
          label: '蚵仔煎'
        }]
    }
  },

  methods: {
    goRefund() {
      this.dialogVisible = true
    },
    toPay(order,orderStatus,payType){
       order.status =orderStatus;
        if(!empty(this.payType)){
            order.payType = payType;
        }
        this.$router.push({path:'/topay',query:order})
    },
    toOrder(product){
        product.id = product.productId;
        product.status = this.status;
        this.$router.push({path:'/ProductDetail',query: product})
    },
    toDetail(product,orderStatus){
        product.id = product.productId;
        product.status = orderStatus;
        if(!empty(this.payType)){
            product.payType = this.payType;
        }
        this.$router.push({path: '/refundoderDetail',query: product})
    }
  },
};
</script>

<style lang="scss" scoped>
.list-item {
  text-align: left;

  .list-img {
    width: 80px;
    height: 80px;
    background-color: #ececec;
    border: solid 1px #dcdcdc;
    margin-right: 20px;
    img {
      width: 100%;
    }
  }
  .list-btn {
    width: 140px;
    line-height: 40px;
    font-size: 16px;
    text-align: center;
    color: #676767;
    border: solid 1px #dcdcdc;
    margin: 6px 0;
    cursor: pointer;

    &.active {
      background-color: #cf2626;
      border: solid 1px #cf2626;
      color: #f5f5f5;
    }
  }
  
  p {
    font-size: 14px;
    color: #454545;
    line-height: 30px;
  }
  span {
    font-size: 12px;
    color: #ea180a;
  }
}
.sub-btn{
  text-align: left;
}
.maney-remarks {
  display: inline-block;
  width: 100%;
  text-align: left;
  font-size: 14px;
  color: #9d9d9d;
}
</style>
